<html>
<head>
<script>

function done() {
   if (window.testRunner)
       testRunner.notifyDone();
}

function linkInserter(doc) {
    return function() {
        doc.getElementsByTagName('body')[0].innerHTML += "<link rel='prerender' href='nick.jpg'>";
        done();
    }
}

function navigateIFrameThenInsertLink() {
    var iframe = document.getElementById('iframe');
    iframe.onload = linkInserter(iframe.contentDocument);
    iframe.contentWindow.location = "resources/empty2.html";
}

if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}
</script>
</head>
<body>
<h1>Test navigation and insertion of link prerender elements</h1>

<iframe id=iframe onload="navigateIFrameThenInsertLink()" src="resources/empty.html"></iframe><br>
This test succeeds when it does not crash.  The iframe above this text should also not crash, and should show "Another empty page."

</body>
</html>
